using System;
using System.Collections.Generic;
using System.Text;
using EastBancTech.DSL.FileSystemDefinition;

namespace EastBancTech.InstallerDefinition
{
    public partial class JavaWebApplication
    {
        public virtual FileModel GetAntBuildFile()
        {
            if (this.FileSource == null || this.FileSource.FileSystem == null)
                return null;

            foreach (FileModel file in this.FileSource.FileSystem.Partition.ElementDirectory.FindElements(FileModel.DomainClassId, true))
                if (String.Compare(file.Name, "install.build", true) == 0)
                    return file;

            return null;
        }


        public virtual FileModel GetWarFile()
        {
            if (this.FileSource == null || this.FileSource.FileSystem == null)
                return null;

            foreach (FileModel file in this.FileSource.FileSystem.Partition.ElementDirectory.FindElements(FileModel.DomainClassId, true))
                if (String.Compare(System.IO.Path.GetExtension(file.Name), ".war", true) == 0)
                    return file;

            return null;
        }
       
    }
}
